<?php

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/12/4
 * Time: 7:11
 */
namespace App\Http\Controllers\Home;

use App\Http\Controllers\Controller;
use App\Models\DtkModel;
use App\Models\PromoterModel;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Cookie;

class ProductsController extends Controller
{
    public function testvue()
    {//测试一个vue.js用法


        $res = [];
        return view('home/products/testvue',$res);
    }
    public function getlist(Request $request)
    {//获取产品
        $qun = "11";
        $promoterM = new PromoterModel();
        $qunInfo = $promoterM->getInfoByQun($qun)->toArray();
        if(empty($qunInfo))
        {
            exit("error,qunid ?");
        }
        $pid = $qunInfo[0]['PID'];
        $dtkM = new DtkModel();
        $res = $dtkM->getHomeListData();
        dd($res);


        $res = ['res'=>$res,'qun'=>$qun];

        return view('home/products/pcgetlist',$res);
        //return view('home/products/wapgetlist',$res);
    }
    public function products()
    {

    }
    public function getImgAndQr($img)
    {//本地文件流读取图片 加上二维码
        header("Content-type: image/jpeg");
    }
    public function getImgByUrl($img)
    {//通过url获得图片

    }
    public function getImgByGoodsId($goodsId)
    {//通过商品id获得图片
        $dtkM = new DtkModel();
        $res = $dtkM->getImgById($goodsId);
        $res = (array)$res[0];
        $pic = $res['Pic'];
        $imgData = file_get_contents($pic);
        header("Content-type: image/jpeg");
        echo $imgData;
    }
    public function getKouling(Request $request)
    {//获取淘口令

    }
    public function getShortUrl(Request $request)
    {//获取短连接

    }




}